from tortoise.fields import CharField, BooleanField, BigIntField, CharEnumField
from application.enumeration.NoteTypeEnum import NoteTypeEnum
from application.model import TortoiseBaseModel


class NoteModel(TortoiseBaseModel):
    """
    帖子表
    """
    user_id: int = BigIntField(null=False, description="用户ID")
    video_id: str = CharField(max_length=32, null=True, description="视频md5_index")
    image_ids: str = CharField(max_length=300, null=True, description="图片md5_index列表，以逗号分隔，最多9张图片")
    title: str = CharField(max_length=20, null=True, description="帖子标题，长度为20")
    content: str = CharField(max_length=1000, null=True, description="帖子内容，长度为1000")
    note_type: str = CharEnumField(enum_type=NoteTypeEnum, max_length=10, null=True, description="帖子类型，原创/转载等")
    is_disabled: bool = BooleanField(null=True, default=False, description="是否禁用")

    class Meta:
        table: str = "note"  # 表名
        table_description: str = "帖子表"  # 表描述
